Skip to content

Path package in context aware #8621

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 12, 2018
Merged

Path package in context aware #8621

merged 1 commit into from
Jan 12, 2018

Conversation

takman1
Copy link
Contributor

@takman1 takman1 commented Nov 10, 2017

How to reproduce :

  • Application has a base url (/some-base-url)
  • Using "PathPackage"
  • Using RequestStackContext (3rd parameter),
  • getUrl of asset with absolute path.

Result :
Both "base url" of application and "base path" of PathPackage are ignored.

Example :
Application base url : /some-prefix
$package = new PathPackage('/static/', new StaticVersionStrategy('v1.2'), new RequestStackContext($requestStack));
echo $package->getUrl("/img.png"); // /img.png?v1.2

Check merged PR #8574.

NB : Maybe there a conception problem in Asset component. I my opinion only "base path" should be ignored but "base url" should always be used to prefix the generated asset path.

How to reproduce :
  - Application has a base url (/some-base-url)
  - Using "PathPackage"
  - Using RequestStackContext (3rd parameter),
  - getUrl of asset with absolute path.

Result :
  Both "base url" of application and "base path" of PathPackage are ignored.

Example :
  Application base url : /some-prefix
  $package = new PathPackage('/static/', new StaticVersionStrategy('v1.2'), new RequestStackContext($requestStack));
  echo $package->getUrl("/img.png"); // /img.png?v1.2

Check merged PR symfony#8574.

NB : Maybe there a conception problem in Asset component. I my opinion only "base path" should be ignored but "base url" should always be used to prefix the generated asset path.
@javiereguiluz
Copy link
Member

@takman1 thanks for fixing this issue with the leading slash in asset paths in different articles across the Symfony Docs.

@javiereguiluz javiereguiluz merged commit 0dbb635 into symfony:3.3 Jan 12, 2018
javiereguiluz added a commit that referenced this pull request Jan 12, 2018
This PR was merged into the 3.3 branch.

Discussion
----------

Path package in context aware

How to reproduce :
  - Application has a base url (/some-base-url)
  - Using "PathPackage"
  - Using RequestStackContext (3rd parameter),
  - getUrl of asset with absolute path.

Result :
  Both "base url" of application and "base path" of PathPackage are ignored.

Example :
  Application base url : /some-prefix
  $package = new PathPackage('/static/', new StaticVersionStrategy('v1.2'), new RequestStackContext($requestStack));
  echo $package->getUrl("/img.png"); // /img.png?v1.2

Check merged PR #8574.

NB : Maybe there a conception problem in Asset component. I my opinion only "base path" should be ignored but "base url" should always be used to prefix the generated asset path.

Commits
-------

0dbb635 Path package in context aware
@takman1
Copy link
Contributor Author

takman1 commented Jan 12, 2018

Thanks for merging @javiereguiluz.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants